<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/sybida/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/sybida/bs/bootstrap.min.css">
    <script src="/sybida/common/js/locahostadress.js" charset="utf-8"></script>
    <style>

        .nav_guide {
            width: 660px;
            height: 30px;
            line-height: 30px;
            border: 0px;
            margin-bottom: 0px;
            margin-top: 0px;
            padding: 0px;
        }

        .nav_guide {
            font-size: 12px;
            text-decoration: none;
            outline: none;
        }

        .nav_guide:link {
            color: #999999;
            text-decoration: none;
        }

        .nav_guide:visited {
            text-decoration: none;
            color: #999999;
        }

        .nav_guide:hover {
            text-decoration: underline;
            color: #FF0000;
        }

        .nav_guide:active {
            text-decoration: none;
        }

    </style>
</head>
<body>
<br>
<span>

</span>
<div style="border-bottom: #0C0C0C 1px solid;">当前位置：<a href="/" class="nav_guide">学生就业情况</a>
</div>
<div class="container">
    <br>
    <div class="layui-form-item">
        <label class="bg-success" style="line-height: 35px; font-size: 16px;">每页大小:&nbsp;</label>
        <select class="form-control" id="pageSizeSel" style="width: 100px; display: inline-block">
            <option name="pageSize" value="5">5条</option>
            <option name="pageSize" value="10">10条</option>
            <option name="pageSize" value="15">15条</option>
            <option name="pageSize" value="20">20条</option>
            <option name="pageSize" value="30">30条</option>
            <option name="pageSize" value="40">40条</option>
            <option name="pageSize" value="50">50条</option>
            <option name="pageSize" value="80">80条</option>
            <option name="pageSize" value="100">100条</option>

        </select>
        <button type="button" id="selectButt" class="btn btn-success">&nbsp;查&nbsp;&nbsp;询&nbsp;</button>
        <input type="text" value="" placeholder="请输入您要查找的学生名称" id="searcheStuId" style="width: 200px;height: 32px;border-radius: 0em;border-color: #e6e6e6">
        <button type="button" id="selectButt1" class="btn btn-success">&nbsp;查&nbsp;&nbsp;询&nbsp;</button>
        <button type="button" id="downloadfilevitae" class="btn btn-success">班级导出表格</button>
    </div>

    <table class="table table-striped table-hover table-bordered" id="showAllInfo">
        <tr class="active">
            <th scope="col"><input type="checkbox" id="chk">&nbsp;&nbsp;全选</th>
            <!--<th style="width: 80px;">-->
            <!--<input type="checkbox" name="checkAll">&nbsp;&nbsp;全选</th>-->
            <th>学生姓名</th>
            <th>学生性别</th>
            <th>班级名称</th>
            <th>毕业学校</th>
            <th>手机号</th>
            <th>身份证号</th>
            <th>是否毕业</th>
            <th>专业</th>
            <th>微信</th>
            <th>就业城市</th>
            <th>家长电话</th>
            <th>家长姓名</th>
            <th scope="col">查看</th>
            <th scope="col">删除</th>
        </tr>
        <hr/>
    </table>

</div>
<div class="container" style="text-align: center">
    <nav aria-label="...">
        <ul class="pagination" id="pagination">
        </ul>
    </nav>
</div>
<div>
    <!--单个模态框-->
    <div class="modal fade" style="margin-top:100px;padding-top:100px;" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">

                <div class="modal-body" style="margin-top: 20px;">
                    <form>
                        <div class="form-group" >
                            <label id="messagetext" class="control-label">Message:</label>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button"  class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" id="deleteOneSure" class="btn btn-primary">确定</button>
                </div>
            </div>
        </div>
    </div>

    <!--多个删除模态框-->
    <div class="modal fade" id="exampleModalAll" style="margin-top:100px;padding-top:100px;" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"></span></button>
                    <h4 class="modal-title" id="exampleModalLabel">删除</h4>
                </div>
                <div class="modal-body" style="margin-top: 20px;">
                    <form>
                        <div class="form-group">
                            <label id="mm" class="control-label">确认将所选的学生删除</label>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button"  id="canle" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" id="deleteAllSure" class="btn btn-primary">确认删除</button>
                </div>
            </div>
        </div>
    </div>

</div>
<div class="container" style="width: 70%;margin: 0 auto;display: none;" id="detailCon">
    <table class="table table-striped table-hover table-bordered" id="detailedInfo">
        <tr class="active">

            <th>学生姓名</th>
            <th>学生性别</th>
            <th>班级名称</th>
            <th>毕业学校</th>
            <th>手机号</th>
            <th>身份证号</th>
            <th>是否毕业</th>
            <th>专业</th>
            <th>微信</th>
            <th>就业城市</th>
            <th>家长电话</th>
            <th>家长姓名</th>
            <th scope="col">修改</th>
            <th scope="col">删除</th>
        </tr>
        <hr/>
    </table>
</div>


<script src="/sybida/jquery/jquery-3.3.1.min.js"></script>
<script src="js/infoStudent.js"></script>
<script src="/sybida/bs/bootstrap.min.js"></script>
<script src="/sybida/layui/layui.js"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->

<script>
    var layer
    layui.use('layer', function(){
        layer = layui.layer;
    });
    $("#downloadfilevitae").click(
    function () {
        layer.open({
            type: 2,//Page层类型
            area: ['500px', '400px'],
            skin: "",
            title: ['请选择您的班级',
                'border:none; background:#CAE1FF; color:#000;'],
            shade: 0.6, //遮罩透明度
            maxmin: false, //允许全屏最小化
            anim:-1, //0-6的动画形式，-1不开启
            // content: $('#findPassTp2').html(),
            content: '/sybida/teacher/downloadClass.html',
            success: function () {}

        });
    }
    )


    $("#canle").click(function (){
        $("#exampleModalAll").attr("class","modal fade")
        $("#exampleModalAll").css("display","none")
    })

    var idtea
    $('#exampleModal').on('show.bs.modal', function (event) {
        var button = $(event.relatedTarget) // Button that triggered the modal
        idtea = button.data('id') // Extract info from data-* attributes
        var name = button.data('name') // Extract info from data-* attributes
        // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
        // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
        var modal = $(this)
        modal.find('#messagetext').text('确认将学生-' +name+'-删除吗？')
    })

    $("#deleteOneSure").click(function (){
        var s=new Array();
        console.log(idtea+"======================")
        s[0] = idtea;
        $.post({url:url+"/student/deleteallstudent",
            // 告知传递参数类型为json，不可缺少
            contentType:"application/json",
            data:JSON.stringify(s),
            beforeSend: function(request) {
                request.setRequestHeader("token", userid);
            },
            success:function (data) {
                if(data== -1000){
                    location.href=logindexurl
                }else{
                    if(data.code==1){
                        location.href="/sybida/student/infoStudent.html?pageNum=1&pageSize="+pageSize;
                    }else{
                        layer.alert("删除失败");
                    }
                }

            }},"json")

        //删除写这里
    })

    $("#deleteAllSure").click(function (){

        var checkbox = $("input[name='optionAll']");
        var s=new Array();
        var j=0
        for(var i = 0;i<checkbox.length;i++)
        {
            if(checkbox[i].checked==true)
            {console.log(checkbox[i].value)
                s[j++]=(checkbox[i].value)
            }
        }
        var userid=getCookie("userid")
        if(s.length>0){ $.post({
            url:url+"/student/deleteallstudent",
            // 告知传递参数类型为json，不可缺少
            contentType:"application/json",
            data:JSON.stringify(s),
            beforeSend: function(request) {
                request.setRequestHeader("token", userid);
            },
            success:function(data){
                if(data== -1000){
                    location.href=logindexurl
                }else{
                    if(data.code===1){
                        location.href="/sybida/student/infoStudent.html?pageNum=1&pageSize="+pageSize;

                    }else{
                        layer.alert("删除失败请重试！");
                        $("#exampleModalAll").attr("class","modal fade")
                        $("#exampleModalAll").css("display","none")
                    }

                }

            }
        })}else{

            layer.alert("所选数据为空！");
            $("#exampleModalAll").attr("class","modal fade")
            $("#exampleModalAll").css("display","none")
        }
    })


</script>

</body>
</html>